﻿using DataMonitor_IBLL;

using DataMonitorMysql.MappingClass;
using DataMonitorWebApi.Utility;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.Caching.Memory;

namespace DataMonitorWebApi.Controllers
{
    [Route("[controller]/[action]")]
    [ApiController]
    public class FileWatchController : ControllerBase
    {
        private readonly ILogger<FileWatchController> _logger;
       
        private readonly FileWatcherHelper _watcherHelper;
        public FileWatchController( ILogger<FileWatchController> logger ,FileWatcherHelper watcherHelper)
        {
            _logger = logger;
           
            _watcherHelper = watcherHelper;
         
        }
        [HttpGet]
        public IActionResult BeginWatch(string path)
        {
            _watcherHelper.WatcherStrat(path, "*.csv");
            _logger.LogInformation(path+"开始监控");
            return Ok("ok");
        }
       
    }
}
